<tr class='custom-tr'
    data-id="{{id}}" title='{{name}}' data-parent='{{parent.id}}' data-extend="1">
  <td style="padding-left:{{multiply depth 14}}px;">
    <span class="toggle cursor-pointer" data-id="{{id}}" data-childrenlen='{{children.length}}'>
      {{#if children.length}}
        <i class="bi bi-folder-plus"></i>
      {{else}}
        <i class="bi bi-file-earmark"></i>
      {{/if}}
    </span>
    <span style="padding-left: .5rem">{{name}}</span>
  </td>
  <td>{{url}}</td>
  <td>
    {{#if (equal type 'menu')}}
      <span class="badge bg-success">菜单</span>
    {{else if (equal type 'module')}}
      <span class="badge bg-primary">模块</span>
    {{else if (equal type 'feature')}}
      <span class="badge bg-info">功能</span>
    {{/if}}
  </td>
  <td>
    <span
      data-bs-toggle='tooltip'
      data-bs-title='点击更新状态'
      class='status-toggle'
      data-id='{{id}}'
      data-status='{{status}}'
    >
      {{#if status}}
        <i class='bi bi-check-circle-fill text-success'></i>
      {{else}}
        <i class='bi bi-x-circle-fill text-danger'></i>
      {{/if}}
    </span>
  </td>
  <td style='width: 140px'>
    <span class='sort-toggle' data-edit='0' data-id='{{id}}'>
      <span
        data-bs-toggle='tooltip'
        data-bs-title='双击更新排序值'
        class='sort-text'
      >
        {{sort}}
      </span>
      <input
        type='number'
        class='form-control sort-input'
        style='width: 80px'
        value='{{sort}}'
      />
    </span>
  </td>
  <td>
    <a
      type='button'
      href='/admin/asset/{{id}}/edit'
      class='btn btn-primary btn-sm'
    >编辑</a>
    <a
      type='button'
      class='btn btn-danger btn-sm'
      onclick='deleteUser({{id}})'
    >删除</a>
  </td>
</tr>

{{#each children}}
  {{> asset-node this depth=(summation ../depth 1)}}
{{/each}}